package org.jeecg.modules.demo.signatureCA.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.signatureCA.entity.TTGcasign;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface SignatureCAMapper {

    @Select("select * from V_ECP_HETGLINFO t where  t.hetid=#{hetId}")
    List<Map<String, Object>> getGlHeInfoById(String hetId);

    @Select("select * from v_ecp_hetinfo t where  t.hetid=#{hetId}")
    List<Map<String, Object>> getHeInfoById(String hetId);

    @Select("select * from v_ecp_hetslinfo t where  t.hetid=#{hetId}")
    List<Map<String, Object>> getHeSLInfoById(String hetId);

    @Select("select * from CA_SIGN where OBJID=#{hetid} and SIGNTAG=#{signtag} and SIGTYPE='2'")
    List<TTGcasign> getTTGcasign(@Param("hetid")String hetid,  @Param("signtag")String signtag);


    @Select("select YINZMC as qzimg from T_QIANZ where DANJID=#{hetid} and QIANZLX=#{qzlx}")
    List<Map<String, Object>> getQz(String hetid, String qzlx);

    @Select("select  * from v_ecp_user  where userid=#{userid}")
    List<Map<String, Object>> getUserAndTraderByUserid(String userid);

    @Select("select traderid, fullname,abbrname,industryid,regioncode,officephone,mobilephone,address,fax,legallyar,creditnumber,busliccode,taxregcode,subbankname,accountname,bankaccountno,contacts,traderauthstatus,tradertypeid,website,introduce,newoldcho,creditnumber,d.dicname hangy from TRADER left join sys_dict d on trader.industryid=d.diccode where d.dictype='HANGY' and traderid=#{traderid}")
    List<Map<String, Object>> getTraderInfoById(Long traderid);

    @Select("select * from T_QIANZ where DANJID=#{hetid} and QIANZLX=#{qzlx}")
    List<Map<String, Object>> getQzZT(String hetid, String qzlx);

    @Select("select * from CA_SIGN where objid=#{hetid} and signtag=#{signtag}")
    List<Map<String, Object>> getSign(String hetid, String signtag);

    @Insert("insert into T_QIANZ(QIANZID,SYSID,DANJLX,DANJID,QIANZLX,ISIMAGE,YINZMC,QIANZSJ)  values (#{qzid},#{qzid},#{danjlx},#{hetid},#{qzlx},#{isimage},#{orgname},#{date})")
    void saveCustomQz(String qzid, String danjlx, String hetid, String qzlx, String isimage, String orgname, Date date);

    @Insert("insert into CA_SIGN(SYSID,SIGNID,OBJTAG,OBJID,SIGNTAG,SIGNCLOB,USERID,SIGNTIME,PRECLOB,SIGTYPE) values (#{ttgcasign.sysid},#{ttgcasign.signId},#{ttgcasign.objTag},#{ttgcasign.objId},#{ttgcasign.signTag},#{ttgcasign.signClob},#{ttgcasign.userId},#{ttgcasign.signTime},#{ttgcasign.preclob},#{ttgcasign.sigtype})")
    void insertSign(@Param("ttgcasign")TTGcasign ttgcasign);








    @Select("select PAGCTS.GenerateId(#{tableName}) as genrateid from dual")
    List<Map<String, Object>> genrateId(String tableName);
}
